#ifndef DATABASE_H
#define DATABASE_H

// Libraries
#include <sqlite3.h>
#include <cstdio>
#include <cstring>

// Classes
class CDatabase 
{
public:
	 CDatabase();
	~CDatabase();

	int OpenDatabase(const char *TFilename);
	int CreateDatabase(const char *TFilename);

	int RunQuery(const char *TQueryString);
	int RunDataQuery(const char *TQueryString, int THandle=0);
	int RunCountQuery(const char *TQueryString);
	int FetchRow(int THandle=0);
	int CloseQuery(int THandle=0);
	int GetLastInsertID();

	int   GetInt(int TColumnIndex, int THandle=0);
	float GetFloat(int TColumnIndex, int THandle=0);
	const char *GetString(int TColumnIndex, int THandle=0);

private:
	sqlite3 *Database;
	sqlite3_stmt *QueryHandle[2];

};

#endif
